using BLL;
using DAL;
using IBLL;
using IDAL;
using Microsoft.EntityFrameworkCore;
using Web.DAL;
using NLog.Web;
using Web.IBLL;
using Web.BLL;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();





builder.Services.AddDbContext<MyDbContext>(x=>x.UseSqlServer(builder.Configuration.GetConnectionString("Con")));



builder.Services.AddControllers().AddJsonOptions(p=>p.JsonSerializerOptions.PropertyNamingPolicy=null);


builder.Services.AddScoped(typeof(IBaseDAL<>), typeof(BaseDAL<>));

builder.Services.AddScoped<IMemberBLL, MemberBLL>();




builder.Services.AddScoped<IRoomBLL, RoomBLL>();


builder.Services.AddScoped<IHouseBLL, HouseBLL>();
builder.Services.AddScoped<IRNumBLL, RNumBLL>();




builder.Host.UseNLog();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseCors(u=>u.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
app.UseStaticFiles();
app.UseHttpsRedirection();

app.UseAuthorization();
 



app.MapControllers();

app.Run();
